package com.ydc.ln.tutorial.j2se.ms;

import java.io.FileOutputStream;
import java.util.Scanner;

/**
 * I/O相关操作测试
 * 
 * @author ydc
 * @date 上午11:03:13 2013-7-11
 */
public class IOTest {
    public static void main(String[] args) {
        new IOTest().test003(256);
    }

    public void test003(int a) {
        if(((a-1) & a) == 0) {
            System.out.println("true");
        } else {
            System.out.println("false");
        }
    }
    
    public void test002() {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入两个整数，用逗号隔开");
        String str = sc.nextLine();
        String[] nums = str.split(",");
        test002_1(Integer.parseInt(nums[0]));
        test002_1(Integer.parseInt(nums[1]));
        sc.close();
    }

    public void test002_1(int a) {
        System.out.print(a + " 的平方： " + a * a);
        System.out.println("\t" + a + " 的立方： " + a * a * a);
    }

    public void test001() {
        try {
            FileOutputStream fos = new FileOutputStream("out.txt");
            fos.write("字符串写入文件中".getBytes());
            fos.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
